#define  _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
using namespace std;

class TemplateMethod
{
public:
	virtual ~TemplateMethod(){}
	virtual void  operate() final
	{
		 operateA();
		 operateB();
	}
	 virtual void operateA() = 0;
	 virtual void operateB() = 0;
};

class ConcreteMethodA : public TemplateMethod
{
public:
	virtual void operateA()
	{
		cout << "ConcreteMethodA --> operateA" << endl;
	}
	virtual void operateB()
	{
		cout << "ConcreteMethodA --> operateB" << endl;
	}
};

class ConcreteMethodB : public TemplateMethod
{
public:
	virtual void operateA()
	{
		cout << "ConcreteMethodB --> operateA" << endl;
	}
	virtual void operateB()
	{
		cout << "ConcreteMethodB --> operateB" << endl;
	}
};

//int main()
//{
//	TemplateMethod* tm1 = new ConcreteMethodA;
//	tm1->operate();
//
//	TemplateMethod* tm2 = new ConcreteMethodB;
//	tm2->operate();
//	return 0;
//}